<template>
  <view class="container">
    <view class="title">{{ newsDetail.biaoti }}</view>
    <view class="row flex-row">
      <text class="text">点击率: {{ newsDetail.dianjilv }}%</text>
      <text class="text" style="margin-left: 1rem">{{
        newsDetail.createTime
      }}</text>
    </view>
    <view class="content" v-html="newsDetail.neirong"></view>
  </view>
</template>
<script>
export default {
  data() {
    return {
      newsDetail: {},
    }
  },
  onLoad(options) {
    if (options.data) {
      try {
        // 解码并解析 JSON 字符串
        this.newsDetail = JSON.parse(decodeURIComponent(options.data))
        console.log(this.newsDetail)
      } catch (error) {
        console.error('解析新闻详情失败:', error)
      }
    }
  },
  onShow() {},
  methods: {
    goBack() {
      uni.navigateBack()
    },
  },
}
</script>
<style lang="scss" scoped>
.container {
  background-color: #fff;

  .title {
    font-size: 32rpx;
    font-weight: bold;
    padding: 30rpx 30rpx 10rpx;
  }

  .row {
    padding: 0 30rpx;
  }

  .content {
    padding: 30rpx;
    font-size: 28rpx;
    line-height: 1.4;
  }
}
</style>
